package cn.itsource.autoconfigure;

import cn.itsource.properties.WeChatProperties;
import cn.itsource.template.WechatTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//把properties交给Spring管理
@EnableConfigurationProperties({WeChatProperties.class})
public class WechatConfiguration {



    /**
     * WechatTemplate交给Spring管理
     * @param weChatProperties :在类上加上了EnableConfigurationProperties注解 就是交给了Spring管理
     *                         然后传递的参数可以在Spring中获取
     * @return
     */
    @Bean
    public WechatTemplate wechatTemplate(WeChatProperties weChatProperties){

        return new WechatTemplate( weChatProperties);

    }



}
